<template>
    <div class="content">
      <jm-head ref="head"></jm-head>
      <p class="title">{{data.title}}</p>
      <p class="time">{{data.created_at}}</p>
      <div id="detail" v-html="data.detail">
      </div>
    </div>
</template>
<script>
  import { getDetail, saveRecord } from "@/api/notice";
  import JmHead from '../head/head'

  export default {
    name: 'noticeDetail',
    components: {
        JmHead
    },
    data () {
        return {
          data: {}
        }
    },
    activated() {
        this.getDetail(this.$route.query.id);
        this.saveRecord()
        this.$refs.head.setNavBarUrl()
    },
    methods: {
       getDetail(id) {
          const that = this
          getDetail({id}).then(res => {
              this.data = res.data
              this.data.created_at = '时间：' + this.data.created_at
          })
      },
      saveRecord() {
          saveRecord({id: this.$route.query.id}).then(res => {
          })
      }
    }
  }
</script>

<style lang="stylus">
    .content #detail p
        margin-top: .2rem!important;
        line-height: 1.4
        color: black
    .content #detail p img
        max-width: 100%
</style>

<style lang="stylus" scoped>
    .content
        min-height 100vh
        .title
            padding-top: .5rem;
            font-size: .4rem;
            font-weight: bold;
            padding-left: .3rem
            padding-right: .3rem
            line-height: 1.4
        .time
            margin-top: .5rem;
            color: #666
            padding-left: .3rem
        #detail
            padding: 0.3rem 0.3rem 0.1rem 0.3rem;
            p
                line-height: .3rem
</style>
